home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / 2D_3D / 2DLab / Source / TwoDView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  2.8 KB  |  128 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #include <math.h>
  5. #include <stdio.h>
  6. #include <sys/file.h>
  7.  
  8. #import <dpsclient/wraps.h>
  9.  
  10. #import <streams/streams.h>
  11.  
  12. #import <appkit/Matrix.h> 
  13. #import <appkit/Form.h> 
  14. #import <appkit/Button.h> 
  15. #import <appkit/NXColorWell.h>
  16. #import <appkit/TextField.h>
  17. #import <appkit/Slider.h>
  18. #import <appkit/color.h>
  19. #import <appkit/nextstd.h>
  20. #import <appkit/Pasteboard.h>
  21. #import <appkit/SavePanel.h>
  22. #import <appkit/Panel.h>
  23. #import <appkit/NXBitmapImageRep.h>
  24.  
  25. #include "headers.h" /* for Voronoi */
  26.  
  27. typedef enum { OP_PRIM_MST,OP_KRUSKAL_MST,OP_JARVIS_HULL, OP_GRAHAM_HULL,
  28.                OP_VORONOI_DIAGRAM,OP_DELAUNAY_TRIANGULATION, OP_GABRIEL_GRAPH,
  29.                OP_RELATIVE_NEIGHBORHOOD_GRAPH} op;
  30.  
  31. typedef enum { DISP_PTS_ONLY, DISP_PTS_RESULTS } displayFlagType;
  32. /* handy macros */
  33. #define X(i) data[(i)*2]
  34. #define Y(i) data[(i)*2+1]
  35.  
  36. /* when we want to refer to a 2D point by `name' (in cost function calls) */
  37. #define XY(i) &data[(i)*2]
  38.  
  39. /* extern */
  40. extern long random();
  41. extern void srandom(int);
  42.  
  43. @interface TwoDView: View
  44. {
  45.   float *data; /* data[i*2+j], j=0,1, i=1..numPoints (dynamic) */
  46.   int numPoints;
  47.   op operation;
  48.   displayFlagType displayFlag;
  49.   BOOL instanceMode;
  50.   int autoUpdate;
  51.   float width;
  52.  
  53.   id numPointsForm;
  54.   id bgColorWell;
  55.   id fgColorWell;
  56.   id highColorWell;
  57.   id lineWidthText;
  58.   id lineWidthSlider;
  59.   id statusText;
  60.  
  61.   /* storange must be allocated for some output data structures.
  62.      Specifically, we need to allocate an array of indices for the
  63.      MST edges ((numPoints-1)*2 integers), an array of (numPoints)
  64.      integers for the convex hull edges (worst case).
  65.  
  66.      We don't need any visible storage for the voronoi/Delaunay data
  67.      structure because the libvoronoi routines allocate memory for that
  68.      stuff internally. */
  69.  
  70.   BOOL mstExists;
  71.   int *mst_edge;
  72.   BOOL chExists;
  73.   int *ch_vertex;
  74.   int nch_vertices;
  75.   BOOL vorExists;   /* voronoi OK => Delaunay OK */
  76.   BOOL dtExists;
  77.   int *dt_edge;
  78.   int ndt_edge;
  79.   BOOL ggExists;
  80.   int *gg_edge;
  81.   int ngg_edge;
  82.   BOOL rngExists;
  83.   int *rng_edge;
  84.   int nrng_edge;
  85. }
  86.  
  87. + newFrame:(NXRect *)frameRect;
  88.  
  89. - setFgColorWell:sender;
  90. - setBgColorWell:sender;
  91. - setHighColorWell:sender;
  92. - setAutoUpdate:sender;
  93. - setOperation:sender;
  94.  
  95. - random:sender;
  96. - animThenDisp:sender;
  97. - disp:sender;
  98. - (BOOL)acceptsFirstResponder;
  99. - mouseDown:(NXEvent *)theEvent;
  100. - free;
  101. - doPrimMST;
  102. - doKruskalMST;
  103. - doJarvisHull;
  104. - doGrahamHull;
  105. - erase;
  106. - drawEdge:(float)x1:(float)y1:(float)x2:(float)y2;
  107. - drawDT;
  108. - drawGG;
  109. - drawRNG;
  110. - drawSelf:(NXRect *)rects:(int) rectCount;
  111. - doVoronoiDiagram;
  112. - doDelaunayTriangulation;
  113. - doGabrielGraph;
  114. - doRelativeNeighborhoodGraph;
  115.  
  116. -saveTIFF:sender;
  117. -saveEPS:sender;
  118.  
  119. -openData:sender;
  120. -saveData:sender;
  121. -close:sender;
  122.  
  123. -copy:sender;
  124.  
  125. -lineWidthChanged:sender;
  126. -(BOOL)acceptsFirstMouse;
  127. @end
  128.